package com.llly.controller;


import com.llly.pojo.Easybuy_user_address;
import com.llly.pojo.ShoppingCar;
import com.llly.service.ShoppingCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class ShoppingCarController {


    @Autowired
    private ShoppingCarService shoppingCarService;

    @RequestMapping("/addShoppingCar")
    public int addShoppingCar(@RequestBody ShoppingCar sc) {
            System.out.println("wudi");
        return shoppingCarService.addShoppingCar(sc);
    }
    
    @RequestMapping("/showAllShoppingCar")
    public Map<String,Object> showAllShoppingCar(@RequestParam Integer uid) {
            System.out.println("9091的showAllShoppingCar"+uid);
        return shoppingCarService.showAllShoppingCar(uid);
    }

    @RequestMapping("/getaddress")
    public List<Easybuy_user_address> getaddress(@RequestParam Integer uid) {
        System.out.println("9091的getaddress"+uid);
        return shoppingCarService.getaddress(uid);
    }

    @RequestMapping("/addAddress")
    public int addAddress(@RequestParam Integer uid,@RequestParam String address,@RequestParam String remark) {
                System.out.println("9091的addAddress"+uid+address+remark);
        return shoppingCarService.addAddress(uid, address, remark);
    }

    @RequestMapping("/updateCar")
    public int updateCar(@RequestParam Integer uid) {
        return shoppingCarService.updateCar(uid);
    }

    @RequestMapping("/delCar")
    public int delCar(@RequestParam Integer uid,@RequestParam Integer pid) {



        return shoppingCarService.delCar(uid,pid);
    }

    @RequestMapping("/xiugaikucun")
    public int xiugaikucun(@RequestParam Integer num,@RequestParam Integer pid) {
        return shoppingCarService.xiugaikucun(num,pid);
    }
    
}
